package org.jmq.myblog.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jmq.myblog.pojo.Article;

import java.util.List;

@Mapper
public interface ArticleMapper extends BaseMapper<Article> {

    @Select("SELECT COUNT(*) FROM `article` WHERE delflag <> 1 AND CONCAT(title,synopsis,content) like #{search};")
    int countArticle(@Param("search")String search);

    @Select("SELECT * FROM `article` WHERE delflag <> 1 AND CONCAT(title,synopsis,content) like #{search} LIMIT #{start},#{num};")
    List<Article> searchArticle(@Param("search")String search, @Param("start")Integer start, @Param("num")Integer num);
}
